package com.jwaoo.mobile.view.register.fragment;

import android.content.Context;
import android.view.View;

import com.dx.as.common.CommonUtils;
import com.dx.as.fragment.TFragment;
import com.jwaoo.mobile.R;
import com.jwaoo.mobile.view.register.IParamListener;
import com.jwaoo.mobile.view.register.presenter.IRegisterView;
import com.jwaoo.mobile.view.register.presenter.RegisterPresenter;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * Created by jwaoo on 2017/10/17.
 */

public class SuccessFragment extends TFragment implements IRegisterView {
    private RegisterPresenter presenter;
    private IParamListener listener;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        listener = (IParamListener) context;
    }

    @Override
    public void initView() {
        findView(R.id.btn_next).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().finish();
            }
        });

        findView(R.id.btn_send_email).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Map<String ,Object> map = new HashMap<>();
                map.put("account", CommonUtils.getAccount());
                presenter.doSendEmail(map);
            }
        });
        initToolbar();
    }

    @Override
    public int setLayoutI() {
        return R.layout.fragment_success;
    }

    @Override
    public void dataOpion() {

    }

    @Override
    public void initRpo() {
        presenter = new RegisterPresenter(getActivity(),this);
    }

    private void initToolbar(){
        setToolBar(null);
    }

    @Override
    public void onRegisterSucess() {

    }

    @Override
    public void onSendEmail() {
        showSnackBar("The dynamic password has been sent");
    }
}
